package com.devplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.devplatform.pojo.dto.AdDetailStatsDto;
import com.devplatform.pojo.dto.AdStatisticsDto;
import com.devplatform.pojo.dto.ChartDataDto;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface AdStatisticsMapper extends BaseMapper<AdStatisticsDto> {
    /**
     * 查询总曝光量
     */
    Long selectTotalImpressions(@Param("startDate") Date startDate,
                                @Param("endDate") Date endDate,
                                @Param("position") String position);

    /**
     * 查询总点击量
     */
    Long selectTotalClicks(@Param("startDate") Date startDate,
                           @Param("endDate") Date endDate,
                           @Param("position") String position);

    /**
     * 查询活跃广告数量
     */
    Integer selectActiveAdsCount(@Param("startDate") Date startDate,
                                 @Param("endDate") Date endDate,
                                 @Param("position") String position);

    /**
     * 查询图表数据（按日期分组的曝光、点击、点击率）
     */
    List<ChartDataDto> selectChartData(@Param("startDate") Date startDate,
                                       @Param("endDate") Date endDate,
                                       @Param("position") String position);

    /**
     * 查询广告详情统计列表
     */
    List<AdDetailStatsDto> selectAdDetailStats(@Param("startDate") Date startDate,
                                               @Param("endDate") Date endDate,
                                               @Param("position") String position);
}
